<?php
namespace Admin\Controller;

class ManagerController extends \Components\AdminController{
    public function index(){
        $this->display();
    }
    public function head(){
        $manager = session('manager');
        $this->assign('mg_name', $manager['mg_name']);//获取当前用户
        $this->display();
    }
    public function left(){
        $manager = M('Manager')->find(session('mg_id'));// 获取当前管理员id
        $role = M('role')->find($manager['mg_role_id']);// 获取当前管理员对应的角色id
        $auth_ids = $role['role_auth_ids'];// 对应角色的权限id集合
        if ($manager['mg_role_id'] == 0) {//超级管理员
            $info1 = M('auth')->where("auth_level = 0")->select();// 顶级权限
            $info2 = M('auth')->where("auth_level = 1")->select();// 二级权限
        } else {
            $info1 = M('auth')->where("auth_level = 0 and auth_id in ($auth_ids)")->select();// 顶级权限
            $info2 = M('auth')->where("auth_level = 1 and auth_id in ($auth_ids)")->select();// 二级权限
        }
        $this->assign('info1', $info1);
        $this->assign('info2', $info2);

        $this->display();
    }
    public function right(){
        $manager = session('manager');
        $this->assign('mg_name', $manager['mg_name']);//获取当前用户
        $this->display();
    }
    public  function managertest1(){
        echo '这是Manager控制器的测试1方法<br>';
    }
}